<?php #20070418 http://www.framework.altervista.org/FrameWork/applications/03_download/01_download/application.inc

define('APPDOWNLOAD','1.00');

/************************************************************************/

/* FrameWork  test preview                                              */

/* ==================================================================== */

/*                                                                      */

/* This program is free software. You can redistribute it and/or modify */

/* it under the terms of the GNU General Public License as published by */

/* the Free Software Foundation; either version 2 of the License.       */

/************************************************************************/



if (!file_exists("datas/$path/$apptitle"))mkdir("datas/$path/$apptitle",0755);

if (!file_exists("datas/$path/$apptitle/Files"))mkdir("datas/$path/$apptitle/Files",0755);



//aggiorna il contatore se richiesto un download e lo esegue

$filepath=$_GET['filepath'];

$filename=$_GET['filename'];

if ($filename!=""){

    $count=@join(@file("datas/$path/$apptitle/$filename.count"));

  $count++;

  $fp=fopen("datas/$path/$apptitle/$filename.count","w");

  fwrite($fp,$count);

  fclose($fp);

  //collega al file

?>



<div class='table appl'>

  <h3>Download</h3>

<p>

 grazie per aver deciso di scaricare <b><?=$filename ?></b><br />

 clicca sul link qui sotto per iniziare il download<br />

<a href='<?=$filepath?>/<?=$filename?>' ><?=$filename?></a>

</p>

</div>





<?php

die();

}



function download_list($filepath,$appname,$apptitle,$path){



  $fd=opendir("$filepath");

  $i=0;

	while (false !== ($filelist[$i++]= readdir($fd)));

  sort($filelist);

  foreach ($filelist as $filename){

	    if ($filename[0]!='.' && substr($filename,-5)!=".desc" && $filename!="")

		echo "

		    <tr>

		    <td><a href='index.php?appname=$appname&filepath=$filepath&filename=$filename' >$filename</a></td>

		    <td>".filesize("$filepath/$filename")." kb</td>

		    <td>".@join(@file("datas/$path/$apptitle/$filename.count"))."</td>

		    <td>".date("d-m-Y|H:i:s", filectime("$filepath/$filename"))."</td>

		    <td> ".@join(@file("$filepath/$filename.desc"))." </td>

		    </tr>

		";

	}

	closedir($fd);

}

?>



<div class='table appl'>



	<h3 class='bartitle'>Old Versions</h3>



	<table id='download' class='class_table'>



		<tr class='firstrow'>



			<td>File</td>



			<td>Size</td>



			<td>Downloads</td>



			<td>Date</td>



			<td>Description</td>



		</tr>



		<?php download_list("$path/$appname/files",$appname,$apptitle,$path); ?>

		<?php download_list("datas/$path/$apptitle/Files",$appname,$apptitle,$path); ?>



	</table>



</div>













